package odgs.message.client;

import odgs.Connection;
import odgs.message.Message;
import odgs.message.MessageHandler;
import odgs.message.MessageProcessor;
import odgs.transaction.MoveTransaction;

public class MoveResponseTransactionHandler implements MessageHandler
{
	public void execute(MessageProcessor processor, Message msg, Connection con)
	{
		MoveTransaction tran = (MoveTransaction) msg.get("transaction");
		if(msg.getResult() < 0)
		{
			processor.getTransactionManager().error(msg.getResult(),tran);
		}
		else
		{
			processor.getDataManager().move(tran.getSource(), tran.getDestPath());
			processor.getTransactionManager().doneTransaction(tran.getRequestId());
		}
	}
}